require("noice").setup({
	presets = {
		bottom_search = true,
		command_palette = true,
		long_message_to_split = true,
		inc_rename = false,
		lsp_doc_border = false,
	},
	smart_move = {
		enabled = true,
		excluded_filetypes = { "cmp_menu", "cmp_docs", "notify" },
	},
	views = {
		mini = {
			position = {
				row = "90%",
				col = "100%",
			},
		},
		cmdline_popup = {
			position = {
				row = "30%",
				col = "50%",
			},
			-- position = { row = 2, col = 2 },
			-- relative = "cursor",
			-- size = {
			-- 	width = "50%",
			-- 	height = "auto",
			-- }
		},
	},
	routes = {
		{
			filter = {
				event = "msg_show",
				any = {
					{ find = "%d+L, %d+B" },
					{ find = "; after #%d+" },
					{ find = "; before #%d+" },
				},
			},
			view = "mini",
		},
	},
	messages = {
		enabled = true,
		view = "notify",
		view_warn = "notify",
		view_error = "notify",
		view_history = "messages",
		view_search = "virtualtext",
	},
	popupmenu = {
		enabled = true,
		backend = "nui",
		kind_icons = {},
	},
	redirect = {
		view = "popup",
		filter = { event = "msg_show" },
	},
	notify = {
		enabled = true,
		view = "notify",
	},
	lsp = {
		-- progress = { enabled = true },
		signature = { enabled = false },
		hover = { enabled = false, silent = true },
		override = {
			["vim.lsp.util.convert_input_to_markdown_lines"] = true,
			["vim.lsp.util.stylize_markdown"] = true,
			["cmp.entry.get_documentation"] = true,
		},
		message = {
			enabled = true,
			view = "notify",
			opts = {},
		},
		documentation = {
			view = "hover",
			opts = {
				lang = "markdown",
				replace = true,
				render = "plain",
				format = { "{message}" },
				win_options = { concealcursor = "n", conceallevel = 3 },
			},
		},
	},
	markdown = {
		hover = {
			["|(%S-)|"] = vim.cmd.help,
			["%[.-%]%((%S-)%)"] = require("noice.util").open,
		},
		highlights = {
			["|%S-|"] = "@text.reference",
			["@%S+"] = "@parameter",
			["^%s*(Parameters:)"] = "@text.title",
			["^%s*(Return:)"] = "@text.title",
			["^%s*(See also:)"] = "@text.title",
			["{%S-}"] = "@parameter",
		},
	},
	commands = {
		history = {
			view = "split",
			opts = { enter = true, format = "details" },
			filter = {
				any = {
					{ event = "notify" },
					{ error = true },
					{ warning = true },
					{ event = "msg_show", kind = { "" } },
					{ event = "lsp",      kind = "message" },
				},
			},
		},
		last = {
			view = "popup",
			opts = { enter = true, format = "details" },
			filter = {
				any = {
					{ event = "notify" },
					{ error = true },
					{ warning = true },
					{ event = "msg_show", kind = { "" } },
					{ event = "lsp",      kind = "message" },
				},
			},
			filter_opts = { count = 1 },
		},
		errors = {
			view = "popup",
			opts = { enter = true, format = "details" },
			filter = { error = true },
			filter_opts = { reverse = true },
		},
	},
})
